<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background-color: rgb(127, 204, 255);
        }

        .fish1 {
            width: 509px;
            height: 270px;
            background-repeat: no-repeat;
            background: url(./img/shark2.png)left top;
            animation: fishrun 0.8s steps(8) infinite;
            position: relative;
            top: 130px;
        }

        .fish2 {
            width: 171px;
            height: 122px;
            background-repeat: no-repeat;
            background: url(./img/fish.png) left top;
            animation: fishrun1 0.8s steps(6) infinite;
        }

        .quan {
            width: 509px;
            height: 270px;
            animation: fishdong 10s linear infinite;
        }

        .fishswim {
            width: 171px;
            height: 122px;
            animation: fishswi 10s linear infinite;
        }

        @keyframes fishswi {

            30% {
                transform: translate(1000px, -200px) rotate(0deg);
            }

            50% {
                transform: translate(1000px, 100px) rotate(180deg);
            }

            80% {
                transform: translate(0px, 0px) rotate(180deg);
            }

        }

        @keyframes fishrun1 {
            0% {}

            100% {
                background-position: left -1512px;
            }
        }

        @keyframes fishrun {
            0% {}

            100% {
                background-position: left -2160px;
            }
        }

        @keyframes fishdong {
            0% {
                transform: translateX(-500px);
            }

            100% {
                transform: translateX(1500px);
            }
        }
    </style>
</head>

<body>
    <div class="quan">
        <div class="fish1"></div>
    </div>
    <div class="fishswim">
        <div class="fish2"></div>
    </div>

</body>

</html>